/**
 * @param {number[][]} statements
 * @return {number}
 */
 var maximumGood = function(statements) {
  const n = statements.length
  const check = (bool) => {
    for(let i = 0; i<n; i++){
      if(bool[i]){
        for(let j = 0; j<n; j++){
          if(statements[i][j] === 0 && bool[j]) return false
          if(statements[i][j] === 1 && !bool[j]) return false
        }
      }
    }
    return true
  }
  const dfs = (bool, j) => {
    if(check(bool)){
      let cnt = 0
      for(let i = 0; i<n; i++){
        if(bool[i]) cnt++
      }
      ans = Math.max(ans, cnt)
    }
    for(let i = j+1; i<n; i++){
      bool[i] = true
      dfs(bool,i)
      bool[i] = false
    }
  }
  let ans = 0
  for(let i = 0; i<n; i++){
    const bool = new Array(n).fill(false)
    bool[i] = true
    dfs(bool, i)
    bool[i] = true
  }
  return ans
};